
<template>
  <div>
    <el-dropdown v-if="isSettingsShow" class="selectSettings" @command="selectSettings">
      <el-button type="success">设置<i class="el-icon-arrow-down el-icon--right"/></el-button>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item
          v-for="item in options"
          :key="item.value"
          :command="item.value"
          @click="selectedSettings(item.value)">
          {{ item.label }}
        </el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>
    <el-button v-if="isAddShow" icon="el-icon-plus" type="success" @click="add">添加</el-button>
    <el-button v-if="isEditShow" icon="el-icon-edit" type="success" @click="edit">编辑</el-button>
    <el-button v-if="isDelShow" icon="el-icon-delete" type="success" @click="del">删除</el-button>
    <el-button v-if="isSaveShow" icon="el-icon-circle-plus" type="success" @click="save">保存</el-button>
    <el-button v-if="isPlusShow" icon="el-icon-plus" type="success" @click="plus">加载</el-button>
    <el-button v-if="isExportShow" icon="el-icon-document-add" type="success" @click="exportExcel">导入</el-button>
    <el-button v-if="isMuBanShow" icon="el-icon-download" type="success" @click="getMuBan">{{ mbTitle }}</el-button>
    <el-button v-if="isU8Show" icon="el-icon-lightning" type="success" @click="u8">同步U8</el-button>
    <el-button v-if="isSendSmsShow" icon="el-icon-position" type="success" @click="sendSms">发送信息</el-button>
    <el-button v-if="isRejectShow" icon="vxe-icon-undo" type="success" @click="onReject">退回</el-button>
    <el-button v-if="isRefreshShow" icon="el-icon-refresh" type="success" @click="refresh">刷新</el-button>
    <el-button v-if="isBackShow" icon="el-icon-arrow-left" type="success" @click="goBack">返回</el-button>
    <el-button v-if="isLookhlShow" icon="el-icon-view" type="success" @click="lookhl">查看汇率</el-button>
     <el-dropdown v-if="isU8Show"  @command="selectSettingsu8">
      <el-button type="success">多行同步<i class="el-icon-arrow-down el-icon--right"/></el-button>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item
          v-for="item in optionsu8"
          :key="item.value"
          :command="item.value"
          @click="selectedSettingsu8(item.value)">
          {{ item.label }}
        </el-dropdown-item>
      </el-dropdown-menu>
    </el-dropdown>

  </div>

</template>
<script>
export default {
  name: 'BHeaderButtons',
  props: {
    lists: {
      type: Array,
      default: () => []
    },
    isSettingsShow: {
      type: Boolean,
      default: true
    },
    isEditShow: {
      type: Boolean,
      default: true
    },
    isAddShow: {
      type: Boolean,
      default: true
    },
    isDelShow: {
      type: Boolean,
      default: true
    },
    isSaveShow: {
      type: Boolean,
      default: true
    },
    isU8Show: {
      type: Boolean,
      default: true
    },
    isRefreshShow: {
      type: Boolean,
      default: false
    },
    isSendSmsShow: {
      type: Boolean,
      default: false
    },
    isLookhlShow: {
      type: Boolean,
      default: false
    },
    isRejectShow: {
      type: Boolean,
      default: false
    },
    isPlusShow: {
      type: Boolean,
      default: false
    },
    isExportShow: {
      type: Boolean,
      default: false
    },
    isMuBanShow: {
      type: Boolean,
      default: false
    },
    mbTitle: {
      type: String,
      default: '模板下载'
    },
    isBackShow: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      // options: [],
      options: [
        {
          value: 0,
          label: '单据设置'
        },
        {
          value: 1,
          label: '显示SQL语句'
        }
      ],
      optionsu8: [
        {
          value: 0,
          label: '0-300'
        },
        {
          value: 1,
          label: '301-600'
        },
        {
          value: 2,
          label: '601-900'
        },
      ]
    }
  },
  watch: {
    lists(val) {
      this.options = val
    }
  },
  methods: {
    add() {
      this.$emit('onAdd')
    },
    edit() {
      this.$emit('onEdit')
    },
    del() {
      this.$emit('onDelete')
    },
    plus() {
      this.$emit('onPlus')
    },
    exportExcel() {
      this.$emit('onExport')
    },
    getMuBan() {
      this.$emit('onMuBan')
    },
    save() {
      this.$emit('onSave')
    },
    refresh() {
      this.$emit('onRefresh')
    },
    u8() {
      this.$emit('onU8')
    },
    sendSms() {
      this.$emit('onSendSms')
    },
    lookhl() {
      this.$emit('onLookhl')
    },
    onReject() {
      this.$emit('onRejectOrder')
    },
    goBack() {
      this.$emit('onGoBack')
    },
    selectSettings(val) {
      this.$emit('selectSettings', val)
    },
    selectSettingsu8(val) {
      this.$emit('selectSettingsu8', val)
    },
 
  }
}
</script>
<style scoped>
.selectSettings {
  margin-right: 10px;
}
</style>
